#include "com.h"
#include <string.h>

int main()
{
  //客户端不用创建fifo
  int fd = open(MY_FILE, O_WRONLY);
  if(fd < 0)
  {
    perror("open");
    return 1;
  }

  //业务逻辑
  while(1)
  {
    //从键盘上输入
    printf("请输入：");
    fflush(stdout);
    char buffer[64] = {0};
    ssize_t s = read(0, buffer, sizeof(buffer) - 1);
    if(s > 0)
    {
      //输出到server.c
      buffer[s-1] = 0;
      printf("%s\n", buffer);
      write(fd, buffer, strlen(buffer));
    }
  }
  
  close(fd);
  return 0;
}
